package com.cgtong.android.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

public class CustomFragmentPagerAdapter extends FragmentPagerAdapter {

    private List<Fragment> list;

    private String titleArray[];

    public CustomFragmentPagerAdapter(FragmentManager fm, List<Fragment> list, String titleArray[]) {
        super(fm);
        this.list = list;
        this.titleArray = titleArray;

    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titleArray[position];
    }
}